< previous page page_386 next page >

Page 386
0386-01.gif
Figure 12.10
A figure scaled by a factor of two in the X direction.
Reflection
By reflecting an object across the X or Y axis, you can create a mirror image of the object. Figure 12.11 shows an object and its reflection across the Y axis.
Reflecting an object across an axis is equivalent to scaling it with a negative scale factor. For instance, to reflect an object across the Y axis as shown in Figure 12.11, you can scale the object by a factor of 1 in the X direction. You can write the new coordinates of a point as:
e10a6a0a59f035e870d90cca05b85fce.gif
new_x = old_x * (1)
new_y = old_y
You can reflect an object across the X axis similarly by scaling it by a factor of 1 in the Y direction.
e10a6a0a59f035e870d90cca05b85fce.gif
new_x = old_x
new_y = old_y * (1)
Rotation
Rotating an object is a little trickier than translating or scaling one. The equations for rotating a point around the origin by an angle q are:
e10a6a0a59f035e870d90cca05b85fce.gif
new_x = old_x * Cos(q) - old_y * Sin(q)
new_y = old_x * Sin(
q) + old_y * Cos(q)
0386-02.gif
Figure 12.11
An object and its reflection across the Y axis.

 
< previous page page_386 next page >